<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${ctx}/css/sapar.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common.css"/>
    <script type="text/javascript" src="${ctx}/js/jquery.js"></script>
    <script type="text/javascript" src="${ctx}/js/sapar.js"></script>
    <script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
    <script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
    <script type="text/javascript" src="${ctx}/js/mask.js"></script>
    <title>编辑字典</title>
    <style type="text/css">
        .kv-item label {
            width: 90px;
        }

        .dataSel .iselect-wrapper {
            float: left;
            margin-right: 5px;
            width: 245px;
        }

        .dataSel .iselect-wrapper .iselect {
            width: 245px;
        }
    </style>
</head>

<body>
<div id="mask" class="mask"></div>
<div id="saper-container">
    <div id="saper-hd"></div>
    <div id="saper-bd">
        <div class="subfiled clearfix">
            <h2>编辑字典</h2>
        </div>
        <div class="subfiled-content">
            <form class="saper-form" id="dataForm">
                <div class="kv-item clearfix">
                    <label><span class="impInfo">*</span>字典项描述：</label>
                    <div class="kv-item-content">
                        <input type="text" placeholder="字典项描述" class="txt_required" name="dictName" id="dictName"
                               value="${td.dictName}">
                    </div>
                </div>
                <div class="kv-item clearfix">
                    <label>字典项值：</label>
                    <div class="kv-item-content">
                        <input type="text" placeholder="字典项值" name="dictVal" id="dictVal" value="${td.dictVal}">
                    </div>
                </div>

                <div class="buttons">
                    <a href="javascript:;" class="sapar-btn sapar-btn-recom">确定</a>
                    <input type="hidden" name=dictId id="dictId" value="${td.dictId}"/>
                </div>
            </form>
        </div>
    </div>
    <div id="saper-ft"></div>
</div>


<script type="text/javascript">
    $(function () {
        $(".sapar-btn-recom").click(function () {
            var btn = true;
            $(".txt_required").each(function () {
                if ($(this).val() == '') {
                    btn = false;
                    layer.msg("必填项不为空");
                    return false;
                }
            });
            if (btn) {
                showMask();
                $.ajax({
                    type: "POST",
                    url: "${ctx}/dict/dictSave.do",
                    data: $('#dataForm').serialize(),// 你的formid
                    error: function (request) {
                        layer.alert("网络故障，请稍后再试!");
                    },
                    success: function (data) {
                        $("#mask").hide();
                        if (data.status == "true") {
                            layer.alert("保存成功", function () {
                                window.location.href = "${ctx}/dict/dictList.do";
                            });
                        } else {
                            layer.msg(data.msg);
                        }
                    }
                });
            }
        });

    });

</script>
</body>
</html>